package com.example.jacky.android_easeui.demo;

import android.os.Bundle;

import com.example.jacky.android_easeui.R;
import com.example.jacky.android_easeui.base.BaseActivity;
import com.example.jacky.uilibrary.utils.Utils;
import com.example.jacky.uilibrary.view.ToggleButton;

/**
 * Created by jacky on 2016/10/9.
 * sounbus app-developer
 */

public class ToggleButtonActivity extends BaseActivity {
    public static final String TAG = "ToggleButtonActivity";
    private ToggleButton mtb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_togglebutton);
        mtb = (ToggleButton) findViewById(R.id.mtb);

        mtb.setSwitchBackgroundResource(R.mipmap.switch_background);
        mtb.setSlideButtonResource(R.mipmap.slide_button);
        mtb.setToggleState(ToggleButton.ToggleState.open);

        mtb.setOnToggleStateChangeListener(new ToggleButton.OnToggleStateChangeListener() {
            @Override
            public void onToggleStateChanged(ToggleButton.ToggleState state) {
                Utils.showToast(state == ToggleButton.ToggleState.close ? "关闭" : "开启");
            }
        });
    }
}
